from building import *
import os

cwd = GetCurrentDir()

inc = []

src = Glob('*.c')

if GetDepend(['CONFIG_MM_MEMBLOCK']):
    src += Glob('memblock/*.c')

if GetDepend(['CONFIG_MM_TLSF']):
    src += Glob('memallocator/tlsf/*.c')

if GetDepend(['CONFIG_MM_ZONE']):
    src += Glob('zone/*.c')

if GetDepend(['CONFIG_MMU']):
    src += Glob('vm/*.c')
    src += Glob('vm/pgtable/*.c')

if GetDepend(['CONFIG_MM_PAGE']):
    src += Glob('page/tiny/*.c')

group = DefineGroup('mm', src, depend=[''], CPPPATH=inc)

list = os.listdir(cwd)
for item in list:
    if os.path.isfile(os.path.join(cwd, item, 'SConscript')):
        group = group + SConscript(os.path.join(item, 'SConscript'))

Return('group')
